import request from '../index';
import { DOWNLOAD_TEMTEMPLATE } from './api'

const baseUrl = '/base-server';
const financeUrl = '/finance-server';
export const URL_QUERYUSERLIST = `${baseUrl}/user/queryUserList`;
export const URL_UPLOADUSERS = `/api${financeUrl}/subsidyTask/uploadUsers`;
export const URL_DOWNLOADS = `${DOWNLOAD_TEMTEMPLATE}/%E7%94%A8%E6%88%B7%E8%B4%A6%E6%88%B7%E6%A8%A1%E6%9D%BF.xlsx`;

//售后人员信息列表
export const URL_QUERYAFTERSALESLIST = `${financeUrl}/afterSales/pageList`;
//授权码申请记录
export const URL_QUERYRECORDLIST = `${financeUrl}/afterSales/recordPageList`;

//导出用户信息
export const EXPORT_USER = `${baseUrl}/user/exportUser`;
//导出个人钱包流水
export const EXPORT_PERSONALFLOW = `${financeUrl}/account/exportPersonalFlow`;
//导出个人钱包月账单
export const EXPORT_MONTHACCOUNTFLOW = `${financeUrl}/account/exportMonthAccountFlow`;
//导出退款申请
export const EXPORT_REFUNDREQUEST = `${financeUrl}/account/exportRefundRequest`;
// 导出补贴任务执行记录
export const EXPORT_EXECUTERECORD = `${financeUrl}/subsidyTask/exportExecuteRecord`;

// 获取企业用户列表
export const queryUserList = (params: any, pages: any) => {
  return request({
    url: `${baseUrl}/user/queryUserList`,
    params: { form: params, pages: pages },
  });
};

// 用户设置一号多充
export const moreCharging = (params: any) => {
  params.errorHand = true;
  // params.errorHand = true;
  return request({
    url: `${baseUrl}/user/moreCharging`,
    params: { form: params, successMsg: '2' },
  });
};

// 用户重置密码
export const resetPwd = (params: any) => {
  return request({
    url: `${baseUrl}/user/resetPwd`,
    params: { form: params, successMsg: '2' },
  });
};

// 用户重置密码
export const frozenUser = (params: any) => {
  return request({
    url: `${baseUrl}/user/frozenUser`,
    params: { form: params, successMsg: '2' },
  });
};

// 用户删除
export const deleteUser = (params: any) => {
  return request({
    url: `${baseUrl}/user/deleteUser`,
    params: { form: params, successMsg: '2' },
  });
};

// 导入用户
export const URL_USERIMPORT = `${baseUrl}/user/UserImport`;
export const userImport = (params: any) => {
  return request({
    url: `${baseUrl}/user/UserImport`,
    params: { form: params },
  });
};

// 新增企业用户
export const addUser = (params: any) => {
  return request({
    url: `${baseUrl}/user/addUser`,
    params: { form: params, successMsg: '1' },
  });
};

// 修改用户
export const updateUser = (params: any) => {
  return request({
    url: `${baseUrl}/user/updateUser`,
    params: { form: params, successMsg: '1' },
  });
};
// 获取企业用户详情
export const queryUserDetail = (params: any) => {
  return request({
    url: `${baseUrl}/user/queryUserDetail`,
    params: { form: params },
  });
};
// 校验车牌号重复
export const checkUserNumber = (params: any) => {
  return request({
    url: `${baseUrl}/user/checkNumber`,
    params: { form: params },
  });
};

// 分页查询月账单
export const pagingMonthAccountFlow = (params: any, pages: any) => {
  return request({
    url: `${financeUrl}/account/pagingMonthAccountFlow`,
    params: { form: params, pages: pages },
  });
};

// 分页查询退款申请
export const pagingRefundRequest = (params: any, pages: any) => {
  return request({
    url: `${financeUrl}/account/pagingRefundRequest`,
    params: { form: params, pages: pages },
  });
};

/** -------------补贴管理------------- */
export const PAGINGSUBSIDYTASK = `${financeUrl}/subsidyTask/pagingSubsidyTask`;
// 分页查询补贴任务
export const pagingSubsidyTask = (params: any, pages: any) => {
  return request({
    url: `${financeUrl}/subsidyTask/pagingSubsidyTask`,
    params: { form: params, pages: pages },
  });
};
// 保存补贴任务
export const subsidyTaskSave = (params: any) => {
  return request({
    url: `${financeUrl}/subsidyTask/save`,
    params: { form: params, successMsg: '1' },
  });
};
// 更新补贴任务
export const subsidyTaskUpdate = (params: any) => {
  return request({
    url: `${financeUrl}/subsidyTask/update`,
    params: { form: params, successMsg: '1' },
  });
};
// 获取补贴任务详情
export const subsidyTaskGetById = (params: any) => {
  return request({
    url: `${financeUrl}/subsidyTask/getById`,
    params: { form: params },
  });
};
// 分页查询补贴任务
export const pagingExecuteRecord = (params: any, pages: any) => {
  return request({
    url: `${financeUrl}/subsidyTask/pagingExecuteRecord`,
    params: { form: params, pages: pages },
  });
};
// 终止补贴任务
export const terminate = (params: any) => {
  return request({
    url: `${financeUrl}/subsidyTask/terminate`,
    params: { form: params, successMsg: '2' },
  });
};

// 导出补贴任务执行记录
export const exportExecuteRecord = (params: any) => {
  return request({
    url: `${financeUrl}/subsidyTask/exportExecuteRecord`,
    params: { form: params },
  });
};

// 导入单用户
export const uploadUsers = (params: any) => {
  return request({
    url: `${financeUrl}/subsidyTask/uploadUsers`,
    params: { form: params },
  });
};

export const queryIsSupportOcr = (params: any) => {
  return request({
    url: `${baseUrl}/systemSettings/queryIsSupportOcr`,
    params: { form: params },
  });
};

// 新增售后人员
export const addafterSales = (params: any) => {
  return request({
    url: `${financeUrl}/afterSales/addUser`,
    params: { form: params, successMsg: '1' },
  });
};

// 修改售后人员信息
export const updateAfterSales = (params: any) => {
  return request({
    url: `${financeUrl}/afterSales/editUser`,
    params: { form: params, successMsg: '1' },
  });
};

// 获取售后人员信息详情
export const queryAfterSalesDetail = (params: any) => {
  return request({
    url: `${financeUrl}/afterSales/queryUserById`,
    params: { form: params },
  });
};

// 售后人员删除
export const deleteAfterSales = (params: any) => {
  return request({
    url: `${financeUrl}/afterSales/deleteUser`,
    params: { form: params, successMsg: '2' },
  });
};